﻿@using System.Diagnostics;
@using System.Collections;
@using System.Reflection;
@using System.Runtime.Versioning;
@using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Features
@using NewLife.Common;
@using NewLife.Serialization
@inject IHttpContextAccessor HttpContextAccessor
@{
    //Layout = NewLife.Cube.Setting.Current.Layout;
    // var session = HttpContextAccessor.HttpContext.Session;
    var session = HttpContextAccessor.HttpContext.Features.Get<ISessionFeature>()?.Session;
    var session2 = HttpContextAccessor.HttpContext.Items["Session"] as IDictionary<String, Object>;
    ViewBag.Title = "Session列表";
}
@if (session != null)
{
    <table class="table table-bordered table-hover table-striped table-condensed">
        <tr>
            <th colspan="6">
                Session列表(@session.Keys.Count())
            </th>
        </tr>
        <tr>
            <th>名称</th>
            <th>类型</th>
            <th>数值</th>
        </tr>
        @foreach (String item in session.Keys)
        {
            <tr>
                <td>@item</td>
                <td></td>
                <td>@session.GetString(item)</td>
            </tr>
        }
    </table>
}
@if (session2 != null)
{
    <table class="table table-bordered table-hover table-striped table-condensed">
        <tr>
            <th colspan="6">
                Session2列表(@session2.Count)
            </th>
        </tr>
        <tr>
            <th>名称</th>
            <th>类型</th>
            <th>数值</th>
        </tr>
        @foreach (var item in session2)
        {
            <tr>
                <td>@item.Key</td>
                <td>@item.Value?.GetType().FullName</td>
                <td>@item.Value</td>
            </tr>
        }
    </table>
}